package cn.com.xiaoshoujia.activities.service.impl;

import cn.com.xiaoshoujia.activities.activity.ActivitiesOrderActivity;
import cn.com.xiaoshoujia.activities.dto.ActivityOrderSingleMsgDTO;
import cn.com.xiaoshoujia.activities.dto.ActivityProductDTO;
import cn.com.xiaoshoujia.activities.service.ActivitiesOrderService;
import cn.com.xiaoshoujia.activities.vo.ActivitySingleVO;
import cn.com.xiaoshoujia.utils.QueryResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.UnsupportedEncodingException;
import java.util.List;
import java.util.Map;

/**
 * @author dulei
 * @Title: ActivitiesOrderServiceImpl
 * @Description: 订单接口实现类
 * @Time 2017/7/31 16:13
 */
@Service
public class ActivitiesOrderServiceImpl implements ActivitiesOrderService {

    @Autowired
    ActivitiesOrderActivity activitiesOrderActivity;

    /**
     * @Author: dulei
     * @Description: 订单总信息
     * @param: id 拼团活动ID
     * @Date: 2017/7/31 16:14
     */
    public ActivityOrderSingleMsgDTO findOrderMsg(Long id, Integer type) {
        return activitiesOrderActivity.findOrderMsg(id, type);
    }

    /**
     * @Author: dulei
     * @Description: 查询单买订单
     * @Date: 2017/7/31 17:31
     */
    @Override
    public QueryResult listSingle(int pageNum, ActivitySingleVO activitySingleVO) throws UnsupportedEncodingException {
        return activitiesOrderActivity.listSingle(pageNum, activitySingleVO);
    }

    /**
     * @Author: dulei
     * @Description: 拼团订单
     * @Date: 2017/8/2 8:57
     */
    public QueryResult listHead(int pageNum, ActivitySingleVO activitySingleVO) throws UnsupportedEncodingException {
        return activitiesOrderActivity.listHead(pageNum, activitySingleVO);
    }

    /**
     * @Author: dulei
     * @Description: 拼团活动绑定的活动
     * @param: id 拼团活动ID
     * @Date: 2017/8/2 8:57
     */
    public List<ActivityProductDTO> listProduct(Long id) {
        return activitiesOrderActivity.listProduct(id);
    }

    /**
     * @Author: dulei
     * @Description: 导出单买订单
     * @param: id 团购活动ID
     * @Date: 2017/8/2 8:56
     */
    public List<Map<String, Object>> exportSingle(ActivitySingleVO activitySingleVO) throws UnsupportedEncodingException {
        return activitiesOrderActivity.exportSingle(activitySingleVO);
    }

    /**
     * @Author: dulei
     * @Description: 导出团购订单
     * @param: id 团购活动ID
     * @Date: 2017/8/2 8:56
     */
    public List<Map<String, Object>> exportHead(ActivitySingleVO activitySingleVO) throws UnsupportedEncodingException {
        return activitiesOrderActivity.exportHead(activitySingleVO);
    }
}
